#include "mkdirTool.h"

int main (void)
{
	#if defined(_WIN32)
		char path[] = "T:\\";
	#else 
		char path[] = "/Volumes/10_Transferts/";
	#endif
	
	
	char dirNum[256];
	char dirName[256];
	
	
	while(1)
	{
		printf("\nENTREZ LE NUMERO DE DOSSIER\nPar exemple 13665 ou RH8564\n\n");
		//scanf("%s", dirNum); 
		readO(dirNum, 256);
		printf("\n");
		//printf( "Your name is: %s -- and your age is: %d\n", name, val );
		
		
		printf("ENTREZ LE NOM DE DOSSIER\nPar exemple CATCH-A-KING_site-2015\n\n");
		//scanf("%s", dirName); 
		readO(dirName, 256);
		printf("\n");
		
		char name[256] = "";
		strcat(name, dirNum);
		strcat(name, "_");
		strcat(name, dirName);
		
		char dir[256] = "";
		strcat(dir, path);
		strcat(dir, name);
		
		if ( stringHasSpecial(name) == 0 )
		{
			printf("\nCREATION DES REPERTOIRES:\n");
			if ( createDir(dir) > 0 ) {
				createSubDirs(path, dir, dirNum, dirName);
			}
			
			printf("\nTERMINE\n");
			//scanf("%s", dirName); 
			
			
			
			#if defined(_WIN32)
				char sys[256] = "explorer ";
			#else 
				char sys[256] = "open ";
			#endif
			
			strcat(sys, dir);
			system(sys);

			#if defined(_WIN32)
				return 0;
			#else 
				//system("osascript -e 'tell application \"Terminal\" to quit'");
				system("killall Terminal");
				return 0;
			#endif
		}
		else
		{
			printf("\nVOTRE NOM DE DOSSIER CONTIENT DES CARACTERES NON AUTORISES !\n");
			printf("Veuillez recommencer\n");
		}
		
		
		//I( "%s", dirName ); 
		//printf("(appuyez sur une touche pour quitter)");
		//getch();
		
	}
	
	/*char[256] sys = "explorer ";
	strcat(sys, dir);
	system(sys);*/
	
	return 0;
}

/*
	#ifdef _WIN32
	   //define something for Windows (32-bit and 64-bit, this part is common)
	   char path[] = "T:\\test-c\\";
	   char sep[] = "\";
	   #ifdef _WIN64
		  //define something for Windows (64-bit only)
	   #endif
	#elif __APPLE__
		char path[] = "/Volumes/10_Transferts/test-c/";
		char sep[] = "/";
	   #include "TargetConditionals.h"
		#if TARGET_IPHONE_SIMULATOR
			 // iOS Simulator
		#elif TARGET_OS_IPHONE
			// iOS device
		#elif TARGET_OS_MAC
			// Other kinds of Mac OS
		#else
		#   error "Unknown Apple platform"
		#endif
	#elif __linux__
		// linux
	#elif __unix__ // all unices not caught above
		// Unix
	#elif defined(_POSIX_VERSION)
		// POSIX
	#else
	#   error "Un
*/